package main

import (
	"fmt"

	"github.com/gin-gonic/gin"
)

type Handler struct {
	Db *Db
}

func handleCors(c *gin.Context) {
	c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
	c.Writer.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
	c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type")
	if c.Request.Method == "OPTIONS" {
		c.AbortWithStatus(204)
		return
	}
	c.Next()
}

func (h *Handler) handlePing(c *gin.Context) {
	fmt.Println(c.Request.URL)
	Success(c, "pong")
}
